<%--
  Created by IntelliJ IDEA.
  User: Alex
  Date: 4/26/11
  Time: 10:23 AM
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" %>
<div id="sidebar">
    <g:if test="${session.signedIn}">
        <div>
            <h3>${user.username}</h3>
            <ol class="activityFeed">
                <g:each in="${((user.activityFeed.sort({it.dateCreated}).reverse().size>10)?user.activityFeed.sort({it.dateCreated}).reverse().subList(0,10):user.activityFeed.sort({it.dateCreated}).reverse())}">
                    <li>
                        ${it.action}
                    </li>
                </g:each>

            </ol>
            <a href="/FilmRing/user/signOut">Sign Out</a>
        </div>
    </g:if>
    <g:else >
        <div class="signin">
            <h3> Sign In </h3> <br />
            <g:form controller="user" action="signIn">
                Username <br />
                <g:textField name="username" /> <br />
                Password <br />
                <input type="password" name="password" /> <br />
                <g:submitButton id="signIn" name="signIn" value="Sign In"/>
            </g:form>
        </div>
        <div>
            <g:form controller="user" action="signUp">
                <g:submitButton name="signUp" value="Sign Up"/>
            </g:form>
        </div>
    </g:else>
</div>